using System.Collections.Generic;

namespace DocumentCreationSystem.Models
{
    /// <summary>
    /// 记忆系统配置
    /// </summary>
    public class MemoryConfig
    {
        /// <summary>
        /// 是否启用记忆系统
        /// </summary>
        public bool Enabled { get; set; } = false;

        /// <summary>
        /// 提供者：BuiltIn 或 Ai00Mem
        /// </summary>
        public string Provider { get; set; } = "BuiltIn";

        /// <summary>
        /// Ai00Mem 服务地址（当 Provider=Ai00Mem 时生效）
        /// </summary>
        public string Ai00MemBaseUrl { get; set; } = "http://localhost:7007";

        /// <summary>
        /// 相似度阈值（0-1）
        /// </summary>
        public float SimilarityThreshold { get; set; } = 0.7f;

        /// <summary>
        /// 每次检索返回条数
        /// </summary>
        public int TopK { get; set; } = 5;

        /// <summary>
        /// 标签权重（用于上下文重排），越大优先级越高
        /// </summary>
        public Dictionary<string, int> TagWeights { get; set; } = new()
        {
            ["character"] = 4,
            ["world"] = 3,
            ["preference"] = 2,
            ["summary"] = 1
        };

        /// <summary>
        /// 启用时间衰减（越新的记忆越靠前）
        /// </summary>
        public bool EnableTimeDecay { get; set; } = true;

        /// <summary>
        /// 时间衰减半衰期（小时），默认72小时（3天）
        /// </summary>
        public double TimeDecayHalfLifeHours { get; set; } = 72;

        /// <summary>
        /// 启用检索结果去重
        /// </summary>
        public bool EnableDedup { get; set; } = true;

        /// <summary>
        /// 去重指纹长度（基于内容的前N字符归一化后取指纹）
        /// </summary>
        public int DedupFingerprintLength { get; set; } = 120;
    }
}

